﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Windows.Forms;

namespace ServiceTest
{
    public partial class Form1 : Form
    {
        UdpClient udp = new UdpClient(new IPEndPoint(IPAddress.Any, 0));
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            IPEndPoint ipe = new IPEndPoint(IPAddress.Parse("192.168.1.246"), 5000);
            string sendCmd = "界面已被服务启动\r\n";
            byte[] sendByte = Encoding.Default.GetBytes(sendCmd);
            udp.Send(sendByte, sendByte.Length, ipe);

        }

        private void button1_Click(object sender, EventArgs e)
        {
            IPEndPoint ipe = new IPEndPoint(IPAddress.Parse("192.168.1.246"), 5000);
            string sendCmd = "界面按被点击\r\n";
            byte[] sendByte = Encoding.Default.GetBytes(sendCmd);
            udp.Send(sendByte, sendByte.Length, ipe);
        }
    }
}
